using System.Linq;
using Magiq.Tests;
using NUnit.Framework;

namespace Magiq.Sql.Tests {
  [TestFixture]
  public class MagiqToSqlUpdatesTest : BaseMagiqProviderUpdatesTest {
    protected override IMagiqTestConfigurator GetConfigurator() {
      return MagiqToSqlTestConfigurator.Current;
    }

    [Test]
    [Ignore]
    public void ShouldUpdateChainedReferencesWithSeveralSetsThatInvalidatesTheWhereClauseWithCircularDependencies() {
      Magiq.Clear().Register(new MagiqToSql
                               {
                                 DependentTablesUpdateStrategy = new TableVariableDependentUpdateStrategy()
                               });

      TestUpdate(TestClass1s,
                 x => x.StringProperty == "sarasa" && x.Reference.StringProperty == "lolo",
                 s => s.Set(x => x.StringProperty, "lelelele")
                        .Set(x => x.Reference.StringProperty, "lala"),
                 items => items.Select(x => x.Reference).Distinct().Count() + items.Count());
    }
  }
}